Monday, October 10, 2005

preventing timeout with CruiseControl.NET

I was running an ndoc ant task with cruise control. Since we don't have small classes and our solution is absolutely huge I could only create docs on some of our assemblies. I found a tag for CC.NET that would extend the timeout laps. Example code is below.
The key is the <buildTimeoutSeconds> tag when running the nant task. I basically doubled the time b/c I didn't want to bother it any further. Default is 600 seconds.


<nant>
<executable>C:\TDD\nant-0.85-rc3\bin\nant.exe</executable>
<buildFile>ndoc.build</buildFile>
<targetList>
<target>ndoc</target>
</targetList>
<buildTimeoutSeconds>1200</buildTimeoutSeconds>
</nant>

Friday, October 07, 2005

Nant and sequence numbers?

I would like to start using cc.net and nant to produce some unit tests. I'm workign on some additions to web services and want to do unit/functional testing. Each request we make for a new order we need a unique reference number. I wanted Nant to track a sequence number, i.e. xmlWS_UnitTest-1, -2, -3, etc...

Does anyone know how to have nant do that or come up with a series of targets for nant to do that?

Also, does anyone have any experience with using unit testing and web services. What I'm thinking of doing is creating a class (using C#) that inherits from nunit and having each class look for an xml file and sumbitting it to test that the order was placed. I know that's not really unit testing since I'm testing the entire process, it's more like functional testing but it should still be possible. If anyone has seen anyposts please let me know. Thanks?

using NDoc with CC.NET

Below is a copy of the ndoc.build file I created. This will look for a coulple dll's, not all of them yet since it's a large project, and makes html and a .chm file. I was just trying to get something simple started and this is the beginning of it. Since I had a difficult time figuring out everything and I really couldn't find any good examples I figured I'd post this to help out others.


<?xml version="1.0"?>
<project default="ndoc">
<property name="debug" value="true"/>
<property name="Source" value="C:\Source" />


<target name="ndoc" depends="">
<ndoc verbose="true">
<assemblies basedir="${Source}">
<include name="${Source}\BusinessObjects\bin\Debug\BusinessObjects.dll" />
<include name="${Source}\ValueObjects\bin\Debug\ValueObjects.dll" />

</assemblies>


<!--
<summaries basedir="${TDD.Build}">
<include name="NamespaceSummary.xml" />
</summaries>-->
<documenters>
<documenter name="MSDN">
<property name="OutputDirectory" value="${TDD.Build}\doc" />
<property name="HtmlHelpName" value="My Help" />
<property name="HtmlHelpCompilerFilename" value="hhc.exe" />
<property name="IncludeFavorites" value="False" />
<property name="Title" value="Documentation for my web site and Web Services" />
<property name="SplitTOCs" value="False" />
<property name="DefaulTOC" value="" />
<property name="ShowVisualBasic" value="True" />
<property name="ShowMissingSummaries" value="True" />
<property name="ShowMissingRemarks" value="True" />
<property name="ShowMissingParams" value="True" />
<property name="ShowMissingReturns" value="True" />
<property name="ShowMissingValues" value="True" />
<property name="DocumentInternals" value="False" />
<property name="DocumentProtected" value="True" />
<property name="DocumentPrivates" value="False" />
<property name="DocumentEmptyNamespaces" value="False" />
<property name="IncludeAssemblyVersion" value="False" />
<property name="CopyrightText" value="" />
<property name="CopyrightHref" value="" />
</documenter>
</documenters>
</ndoc>

</target>

</project>


Then what I do is I run the above .build file from within my cruisecrontrol.net ccnet.config file using this

<nant>
<executable>C:\nant\bin\nant.exe</executable>
<buildFile>ndoc.build</buildFile>
<targetList>
<target>ndoc</target>
</targetList>
</nant>

Wednesday, October 05, 2005

Working FilterTrigger with CruiseControl.NET

I'm posting this since I haven't found an example online:
I have ccnet up and running but wanted to create a time it didn't run due to server reboots,etc...


The code below will do a build every 2 hours except from 11pm to 7am, every day of the week. It will force a build as well.

<triggers>
<filterTrigger startTime="23:00" stopTime="7:00">
<trigger type="intervalTrigger" buildCondition="ForceBuild" seconds="7200">
<weekDays>
<weekDay> Sunday </weekday>
...
...
</weekDay> Saturday </weekDay>
</filterTrigger>
</triggers>

Enjoy!!!!

Update on emailing CruiseControl.NET Setup and nant properties

I'm using CruiseContro.NET 0.92 and using nant-0.85-rc3. You can use rc2 but you don't get the nant timing report off the CC.NET dashboard if you don't use rc3.

Here are a couple hints from stuff I've learned. It doesn't look as if you can make a mybuild.properties file with Nant that you can with Ant. Instead you can go to the Nant/bin/ folder and look at the nant.exe.config file. There you will find a <properties> </properties> section. In there you can define global properties, such as VSS.Username in the format of

<properties>
<property name="VSS.Username" value="myusername">
<property name="VSS.PWD" value="mypassword">
</properties>

That way in any of your build scripts you can reference the ${VSS.Username} and you don't have to have that info repeated in your script at all, you define it once and that's it.

In my cruise.build (nant file) I have the property nant.onfailure defined so that it emails me but cruisecontrol.net also does that, so you don't have to define it in your nant file. If you want it in your nant file it can look like this:

<property name="nant.onfailure" value="buildFailed">
<target name="buildFailed" depends="">
<echo message="EMAILING NOW...">
<mail from="someEmail" tolist="myemailaddress" mailhost="smtpemail"
subject="Build Failed" message="The autobuild failed!" >
</mail>
</target>

You can define it within the ccnet.config as:

<publishers>
<xmllogger>
<email from="<a href=" from="myemail@mycompany.com">myemail@mycompany.com</a>" mailhost="smtpmail" includeDetails="true">
<users>
<user name="me" group="admin" address="<a href=">myemail@company.com</a>" />
</users>
<groups>
<group name="admin" notification="change">
</groups>
</email>
</publishers>